<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	// http://localhost:8080/staffmgr/
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考勤管理</title>
</head>
<base href="<%=basePath%>">
<body>
<%@ include file="../header.jsp" %>
	<a href="attendance/add.jsp">添加</a>
	<table border="1" width="100%" cellspacing="0">
		<caption>考勤列表</caption>
		<tr>
			<th>ID</th>
			<th>缺勤时间</th>
			<th>员工号</th>
			<th>请假原因</th>
			<th>操作</th>
		</tr>
		<c:if test="${attendances==null }">
			<!-- 跳转页面 -->
			<jsp:forward page="../attendance.do?action=list"></jsp:forward>
		</c:if>
		<c:forEach items="${attendances }" var = "attendance">
		<tr>
			<td>${attendance.id }</td>
			<td><fmt:formatDate value="${attendance.time }" pattern="yyyy-MM-dd"/></td>
			<td>${attendance.staffId }</td>
			<td>
			<c:if test="${attendance.type==0 }">事假</c:if>
			<c:if test="${attendance.type==1 }">调休</c:if>
			<c:if test="${attendance.type==2 }">病假</c:if>
			<c:if test="${attendance.type==3 }">迟到</c:if>
			<c:if test="${attendance.type==4 }">早退</c:if>
			<c:if test="${attendance.type==5 }">旷工</c:if>
			<c:if test="${attendance.type==6 }">带薪年假</c:if>
			</td>
			<td>
			<a href="attendance.do?action=remove&id=${attendance.id }">删除</a>
			<a href="attendance/edit.jsp?id=${attendance.id }">编辑</a>
			
			</td>
		</tr>
		</c:forEach>
	</table>
	<script type="text/javascript">
	<c:if test="${param.error!=null}">
	alert('${param.error}');
	</c:if>
	</script>
	
</body>
</html>